UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ne6YyVCzYPmf10yMYhwFrXbOAuhN5eIFady06P0juk8='
WHERE
key_id = '9546fce8155f4772a97c31cb3b732dcd54ee43f3e8a65e0b989db2dae08b9a25'
AND (
token = 'Ne6YyVCzYPmf10yMYhwFrXbOAuhN5eIFady06P0juk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)