UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4hBLXsp2+O2ddp+9pOIO9CC96uIuwS2tupLvWH9atTA=' 
WHERE 
  key_id = '531a024f49e9843c0f8519b4d2818d979ff694e7501349671a918a8f5fd2c712' 
  AND (
    token = '4hBLXsp2+O2ddp+9pOIO9CC96uIuwS2tupLvWH9atTA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040