UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3QDDmABMBC3VbX2JpdkbDqUFnzAWCEN7SkVR/pl+Sok=' 
WHERE 
  key_id = '99533e26f92f6736b51aef4211e87f0afb6d9fa3e839300a75244e8162db66da' 
  AND (
    token = '3QDDmABMBC3VbX2JpdkbDqUFnzAWCEN7SkVR/pl+Sok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036