UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PYQp6cPJ4SKYOghLFFPuWZ0Mdcr8PbpKZ1ow1zk5YaI='
WHERE
key_id = '1dd752388fdd0cdcdb22e27b5d0370460c26e36941fc7aac869cad987002fd4d'
AND (
token = 'PYQp6cPJ4SKYOghLFFPuWZ0Mdcr8PbpKZ1ow1zk5YaI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)