UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sMoUH2773PCjgOUmPAyAlmDfYx4jnV324BbKCwoKk5Y=' 
WHERE 
  key_id = '21785cac7dae466d486515809694d42cbdfa6550e432f302cebc805f793819e1' 
  AND (
    token = 'sMoUH2773PCjgOUmPAyAlmDfYx4jnV324BbKCwoKk5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028