UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'USOMYE/HtMmEiNLvqVzuzaTO3UF9uRdiC8SON/ND0VI='
WHERE
key_id = 'bd9a0d2afc8a1e2dae1855f1e2e199bad19b21d2e556e4505aca596e0b19ee37'
AND (
token = 'USOMYE/HtMmEiNLvqVzuzaTO3UF9uRdiC8SON/ND0VI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)