UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C48rmCSdytUKEfZuElRCrj4oC3eXi5qA8sJAJVV1DLQ='
WHERE
key_id = '2da5cff84be551b1edd301664f78b11adf1f1c83c0d8620a93c0671800c682d9'
AND (
token = 'C48rmCSdytUKEfZuElRCrj4oC3eXi5qA8sJAJVV1DLQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)