UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'To0xIgfR19hKGOR42DUVsa882H6k7DP9KZK7EHuTEYM=' 
WHERE 
  key_id = '305ecdf3dbca75a697da2eb292e87f10b0d3bbf304041fa0ea577388da32c53c' 
  AND (
    token = 'To0xIgfR19hKGOR42DUVsa882H6k7DP9KZK7EHuTEYM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029