UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yqYv9tJVV45IQmyJm0wxkPdVrNA05rDFpebY/nADFQ4='
WHERE
key_id = '501885cea4b515b7124a2a39ad1cbf46bef13b2fa785f5a63297f57038ecb70c'
AND (
token = 'yqYv9tJVV45IQmyJm0wxkPdVrNA05rDFpebY/nADFQ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)