UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G3poI4j59kKRaKTzO1olhZBGyYC3yhD+wtZpeXEjtqg=' 
WHERE 
  key_id = 'fd21795e0fc915789c77e50e754dc249b69050bd80f95ce66b57dbd0db992553' 
  AND (
    token = 'G3poI4j59kKRaKTzO1olhZBGyYC3yhD+wtZpeXEjtqg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032