UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0sVTHndBTZtaXOi6qjlWd9QQ9faw+f47NQZmmThMrh4='
WHERE
key_id = '1a7cae47a3a3eae80f21596419f376b5e40ade8b056a8db26a295d6425e98011'
AND (
token = '0sVTHndBTZtaXOi6qjlWd9QQ9faw+f47NQZmmThMrh4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)