UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '82w/9/5bfnNRNH39+rKgm5zgqrWRmgAIAlspOkxiuZA=' 
WHERE 
  key_id = '7b27bad6edaed2404c2c3f55f4751f92d436d787613f5e53daae7d120db698ab' 
  AND (
    token = '82w/9/5bfnNRNH39+rKgm5zgqrWRmgAIAlspOkxiuZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017