UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q77gEy/wq/5PjprV3ExbibcaxZeSRZVng8sUnU0XRno='
WHERE
key_id = '536721c2d344cb19ffee96c4a41c868a46b5489fc29fa984b0937c8fd90753d7'
AND (
token = 'Q77gEy/wq/5PjprV3ExbibcaxZeSRZVng8sUnU0XRno='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)