UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bc7yYT5K1hM8/M56+oTb7EIH1RsyITH+lAs/rWWhixg=' 
WHERE 
  key_id = '160f11d252b5bb190575f1bb93217de7884b09091b22b568ca8f64c6131f30fe' 
  AND (
    token = 'bc7yYT5K1hM8/M56+oTb7EIH1RsyITH+lAs/rWWhixg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068