UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RDXSW5eiKccJ8c6XMVyEUyPGD8APuwNaFqPI79o/Q9c='
WHERE
key_id = 'cbbd49e67a392197832bb870ccdd1e5b2b584a757fe8e32caa0987ff9fc9bc7d'
AND (
token = 'RDXSW5eiKccJ8c6XMVyEUyPGD8APuwNaFqPI79o/Q9c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)