UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yumpbraIsCmEfqvh0Kumt+hfip+gfUp2S8V80umSyGo=' 
WHERE 
  key_id = '412c29e11d831c014ada4072e40e0e7733d2503e9d4d2bc7fbdf01ed884b61ce' 
  AND (
    token = 'yumpbraIsCmEfqvh0Kumt+hfip+gfUp2S8V80umSyGo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031