UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'auISUU84+xeLDIlIdDI80OaRWrXdOwxQo65XlzyVk88=' 
WHERE 
  key_id = '52d01f359b5394e598d8d98ca30276da00899eb172d803b718711d726182dab4' 
  AND (
    token = 'auISUU84+xeLDIlIdDI80OaRWrXdOwxQo65XlzyVk88=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054