UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'elGB50SMEJBLclj8IVzCyxXW7pmGbCF8nS+in2blkVg='
WHERE
key_id = 'eb7ca65c00a1bb97cf61f7469413448b89058f3f7ac1ca60c23f8c02f731a64e'
AND (
token = 'elGB50SMEJBLclj8IVzCyxXW7pmGbCF8nS+in2blkVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)