UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uXPHK2eOUjPuTwOgTYptVDwHbj9IE+URrF/ggAkMY/c=' 
WHERE 
  key_id = '5202d68eab99fbecb162608132ae34d703841d57c30377a1ba37d8ce72016782' 
  AND (
    token = 'uXPHK2eOUjPuTwOgTYptVDwHbj9IE+URrF/ggAkMY/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047