UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8xAkSsQE+xste0OukLAgBYLVTrPU3Ajvr9rRmIFA4SI='
WHERE
key_id = 'ca977fdd2c0e6fb0d73f4cd2f4bb9b07833cf6b99e95fb2ba69dd3209a8bf733'
AND (
token = '8xAkSsQE+xste0OukLAgBYLVTrPU3Ajvr9rRmIFA4SI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)