UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y5gJMQof3Ouz53cFoBq/3zFVqkIWknB4RGndz6kKcxA='
WHERE
key_id = 'bca1ec1c6c1b4be7938040ae33ce44c050a3dd6a6b59de6342e4c89b50ce28b3'
AND (
token = 'y5gJMQof3Ouz53cFoBq/3zFVqkIWknB4RGndz6kKcxA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)