UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sy4pTtJ/KwVZyclnXUC+8AjrwDHL7mv9y1NkkA9+PQA=' 
WHERE 
  key_id = '952dd351c971267a3c40e0c8c74a254db90ca1c71cf0d8e5b1eab1879961abc9' 
  AND (
    token = 'Sy4pTtJ/KwVZyclnXUC+8AjrwDHL7mv9y1NkkA9+PQA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023