UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xOn2rA7/A45P7uB10jWqsVv1ekq52s20hQVlDcRAUP4='
WHERE
key_id = 'af30a922984bca404750bfdea589ae25fba08cf8c4ae8faf3ac868232aa0f970'
AND (
token = 'xOn2rA7/A45P7uB10jWqsVv1ekq52s20hQVlDcRAUP4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)