UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tEWi+jwRxGFiBCs3zrVDbTaEkuIANSgwn4C7MEnujdg=' 
WHERE 
  key_id = '2f201ebf34d1f4ee7c4565b4177134b1cfa100d6a892873cd41443eae12bf758' 
  AND (
    token = 'tEWi+jwRxGFiBCs3zrVDbTaEkuIANSgwn4C7MEnujdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035