UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rWfK30N4EKrc+U1TjROz9R4u1KuZSiIyiqsfhYNbEZk=' 
WHERE 
  key_id = 'd4f30dec740a2dbfc36696d3d65331f4b29b539f9d7a50533c7b6551f333ca59' 
  AND (
    token = 'rWfK30N4EKrc+U1TjROz9R4u1KuZSiIyiqsfhYNbEZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027