UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cEkdpDWymjJYwF1qpzWfAjGvqEMAfCQsDcSvG6Hh2sg='
WHERE
key_id = '52ef05c0726b360af6ceae89f56cb362598b89638b0dc85f495b4eb5ba1756f3'
AND (
token = 'cEkdpDWymjJYwF1qpzWfAjGvqEMAfCQsDcSvG6Hh2sg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)