UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6wjTOwHdijjsvnCfNTFuE4WZQZ17ykchLhQrSKTLoDA='
WHERE
key_id = '854f03567bf992cc76f7fc940e84befe61c873a4f44abfa351142f271800079f'
AND (
token = '6wjTOwHdijjsvnCfNTFuE4WZQZ17ykchLhQrSKTLoDA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)