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