UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6RDOxh2FDrAmdtJyVOvmbkINRzksGzgZPvNdWlcY+FQ=' 
WHERE 
  key_id = 'd9a88e91e80842a581dda7f6cd688bca90aa9ee7c30038de53d2b00a5290ed40' 
  AND (
    token = '6RDOxh2FDrAmdtJyVOvmbkINRzksGzgZPvNdWlcY+FQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046