UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ej1+nNJ5kSAJciyxFCUjOT5gNm8ygNeXiYnBhAttEdc=' 
WHERE 
  key_id = '710e31a986b09009c747b8808f87d49e6cf38c664fcbcddf8035a68c3b071e69' 
  AND (
    token = 'ej1+nNJ5kSAJciyxFCUjOT5gNm8ygNeXiYnBhAttEdc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023