UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q8dTCmtxW8HDKtBBQmRCz73P9DlpPo2rzLNc7qDJvis='
WHERE
key_id = '1ca97844a667f9d8c6ebec7d229780f228782fd59b1db74f457a4cab3a5e0d41'
AND (
token = 'q8dTCmtxW8HDKtBBQmRCz73P9DlpPo2rzLNc7qDJvis='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)