UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cJvAYELD/vqDPb5gOH/BTWJBABxs3L7FXbAhzLV4Gi4='
WHERE
key_id = 'c299567253a8e76448f9520cca2ccb600d8d6c86a14c961a935f2f8ab6e79152'
AND (
token = 'cJvAYELD/vqDPb5gOH/BTWJBABxs3L7FXbAhzLV4Gi4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)