UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A9mCR91dNiabPDhQMcm77TxqOCdUdyEZRuP/sElkdzQ='
WHERE
key_id = 'fc0612177d497725885b10062a812e62f0bc24f539f1a689327fa67d68b4f611'
AND (
token = 'A9mCR91dNiabPDhQMcm77TxqOCdUdyEZRuP/sElkdzQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)