UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xEBALqN5BF4ItrBsLuhGNcIrr4lAp2ZL/2PF4Ni5lf4='
WHERE
key_id = 'aaa6bf419eb3a52aa09936eafcf49a0e3c5e5b7aa48a1bc1b51e7e6ce7fe6a49'
AND (
token = 'xEBALqN5BF4ItrBsLuhGNcIrr4lAp2ZL/2PF4Ni5lf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)