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