UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'On6we0HSYqPHpBgUyZym+b6+ojQXlXp/F2lmuC6dDa4=' 
WHERE 
  key_id = '6889edf49c51401dbfd002167e5e66cfd922f6e63504619ee6b59f4216c60fc2' 
  AND (
    token = 'On6we0HSYqPHpBgUyZym+b6+ojQXlXp/F2lmuC6dDa4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052