UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rDss8KDAx8EpYJoj80fpMJ3fJnrbD8WCL/Yanqe87BM='
WHERE
key_id = 'a8a01ad5c4e9a59a34c9f0d8e1453c747865e7fc89d9240a4eab3318839cd8f1'
AND (
token = 'rDss8KDAx8EpYJoj80fpMJ3fJnrbD8WCL/Yanqe87BM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)