UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9+5UByZIVLGQ26JZDoNMoTZu9axvWfQzIAg0WpoeZiI=' 
WHERE 
  key_id = 'e889d107ac1b391b774843f6ea998cd56b16e405442c0d683c2131d62b4ee257' 
  AND (
    token = '9+5UByZIVLGQ26JZDoNMoTZu9axvWfQzIAg0WpoeZiI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036