UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pfsEcZOn926gKRF6BeqvjMID6MQl3DzHnxyQstT047w='
WHERE
key_id = '381af42b7ddb1b86b5aebad9c98281717158f70ef6ad3a58f95dcb77a294066a'
AND (
token = 'pfsEcZOn926gKRF6BeqvjMID6MQl3DzHnxyQstT047w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)