UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XBNPdjAn8v+0VTeNhc811BNbPdPdlDoGZaZt+d6Ufp0='
WHERE
key_id = '87bfe3168ef2178d1f819c96a35e7a4782e3b7aaa7685f606e65ddd33f413524'
AND (
token = 'XBNPdjAn8v+0VTeNhc811BNbPdPdlDoGZaZt+d6Ufp0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)