UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X0r7w3Ms9MoHa4urTuiXiHUfe+GwzoO6v/v3wkJeTp0=' 
WHERE 
  key_id = '52a82cac4877509418c6828d7988217248dd5569e74f20a0251e8f24d037c08e' 
  AND (
    token = 'X0r7w3Ms9MoHa4urTuiXiHUfe+GwzoO6v/v3wkJeTp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029