UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'erTOGer4Ywu9nrrWUw/myFruDFGKxgi4l294hKpyUNM=' 
WHERE 
  key_id = '4d2fad41bc35c43e65a623b1c4894cf595ec8e453e39142bb189356723c56ae1' 
  AND (
    token = 'erTOGer4Ywu9nrrWUw/myFruDFGKxgi4l294hKpyUNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021