UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2PnmW9sgmrNVX8mXJcRS5HIaZPgR3COY5nQy0TAvQic='
WHERE
key_id = 'f1d2bd521c9b3cb4b6090cf025bd45f4070e4bead3a73babee1667c69f7ecb5d'
AND (
token = '2PnmW9sgmrNVX8mXJcRS5HIaZPgR3COY5nQy0TAvQic='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)