UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iyUaWgOPOEKUQpJ6IDuyOuF1JHJz515fjbCRJcNKviE='
WHERE
key_id = 'b579fc0b5317ddc4e621a36f93102832ac307351c5a3640a6ea0940ddf6a3c17'
AND (
token = 'iyUaWgOPOEKUQpJ6IDuyOuF1JHJz515fjbCRJcNKviE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)