UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ps6x8TfXYecxpALRj+igP42TSp9jyI+/e5qhoRCfeD4='
WHERE
key_id = 'ab54ee793928b979736bc9c385e5a131de84c52261cc8d1b2b1aaa15daebfceb'
AND (
token = 'Ps6x8TfXYecxpALRj+igP42TSp9jyI+/e5qhoRCfeD4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)